package com.hspedu.newData.LCR;

import com.hspedu.newData.dmsxl.ds.TreeNode;

/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-05-17 
 * @Version: 1.0
 */

public class LCR175计算二叉树的深度 {

    public int calculateDepth(TreeNode root) {

        if (root == null) return 0;

        int leftDepth = calculateDepth(root.left);
        int rightDepth = calculateDepth(root.right);
        return Math.max(leftDepth,rightDepth) + 1;
    }
}
